export default {
  get: function (key) {
    let rawData = localStorage[key]
    if (rawData) return JSON.parse(localStorage[key])
    else return null;
  },
  set: function (key, data) {
    localStorage[key] = JSON.stringify(data)
  },
  getObject: function (key) {
    return this.get(key) ?? {}
  },
  setObject: function (key, data) {
    this.set(key, data ?? {})
  },
  getArray: function (key) {
    return this.get(key) ?? []
  },
  setArray: function (key, data) {
    this.set(key, data ?? [])
  }
}